home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / c / GAPLib.lha / GAPLib_Beta / diagnostic / CrossoverTest.c next >
C/C++ Source or Header  |  1999-04-22  |  906b  |  62 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <GAP.h>
  4.  
  5. static const unsigned char data[5][8] = {
  6.     {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe},
  7.     {0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00},
  8.     {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
  9.     {0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
  10.     {0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00}
  11. };
  12.  
  13. int main(void)
  14. {
  15. unsigned char t[8],u[8];
  16. int i=0,s=0;
  17.  
  18. memset(t,0,8);
  19. memset(u,0xff,8);
  20.  
  21. Crossover(t,u,63,8);
  22.     if(memcmp(u,data[s++],8)) {
  23.         i++;
  24.     }
  25.  
  26. memset(t,0,8);
  27. memset(u,0xff,8);
  28.  
  29. Crossover(t,u,32,8);
  30.     if(memcmp(u,data[s++],8)) {
  31.         i++;
  32.     }
  33.  
  34. memset(t,0,8);
  35. memset(u,0xff,8);
  36.  
  37. Crossover(t,u,0,8);
  38.     if(memcmp(u,data[s++],8)) {
  39.         i++;
  40.     }
  41.  
  42. memset(t,0,8);
  43. memset(u,0xff,8);
  44.  
  45. Crossover(t,u,7,8);
  46.     if(memcmp(u,data[s++],8)) {
  47.         i++;
  48.     }
  49.  
  50. memset(t,0,8);
  51. memset(u,0xff,8);
  52.  
  53. Crossover(t,u,37,8);
  54.     if(memcmp(u,data[s++],8)) {
  55.         i++;
  56.     }
  57.  
  58. printf("Crossovertest: %d errors.\n",i);
  59.  
  60. return(i);
  61. }
  62.